#include <iostream>
#include <vector>
using namespace std;
int b[200001];
int n, k;
bool check(int mid) {
  int cnt_ones = 0;
  // 初始化第一个窗口
  for (int i = 0; i < mid; ++i) {
    if (b[i] == 1)
      cnt_ones++;
  }
  if (cnt_ones <= k)
    return true;

  // 滑动窗口
  for (int i = mid; i < n; ++i) {
    cnt_ones += b[i] - b[i - mid];
    if (cnt_ones <= k)
      return true;
  }
  return false;
}

int main() {

  cin >> n >> k;

  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    b[i] = c - '0';
  }

  int left = 0, right = n;
  int max_len = 0;
  while (left <= right) {
    int mid = (left + right) / 2;
    // cout << "mid: " << mid << endl;
    if (check(mid)) {
      max_len = mid;
      left = mid + 1;
    } else {
      right = mid - 1;
    }
  }
  cout << max_len << endl;
  return 0;
}
